import type { BluePrint } from "./BluePrint";
import type { UniverseGroup } from "./UniverseGroup";
import type { YAMLUniverseType } from "../index";

export class UniverseType {
  id!: number;
  name!: string;
  groupId!: number;
  portionSize!: number;
  /**
   * 体积
   */
  volume!: number;
  //成分
  materials!: { type: UniverseType; quantity: number }[];
  //产出数量
  productQuantity!: number;
  parent!: UniverseGroup;
  blueprint?: BluePrint;
  static fromYaml(id: number, yaml: YAMLUniverseType) {
    const type = new UniverseType();

    type.id = id;
    type.name = yaml.name.zh;
    type.groupId = yaml.groupID;
    type.portionSize = yaml.portionSize;
    type.volume = yaml.volume;
    return type;
  }
}
